package com.scau.database.controller.aftersalesstaff;

import com.scau.database.entity.aftersale.delay.ApplyDelayVO;
import com.scau.database.entity.aftersale.delay.FinishDelayInIdVO;
import com.scau.database.entity.aftersale.delay.SearchDelayInPhoneVO;
import com.scau.database.entity.aftersale.delay.SearchDelaysResultVO;
import com.scau.database.service.aftersalesstaff.DelayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName: DelayExchangeController
 * @Description: TODO
 * @Author: sunslikes
 * @Date: 2020/6/24 2:43
 * @Version: 1.0
 */
@RestController
@RequestMapping("/api/delay")
public class DelayController {

    @Autowired
    DelayService delayService;

    /**
     * 申请延期交付
     * @param delayVO
     * @return 返回等待订单号
     */
    @PostMapping("/apply")
    public String applyDelay(@RequestBody @Valid ApplyDelayVO delayVO) {
        return delayService.applyDelay(delayVO);
    }

    @PostMapping("/finish")
    public String finishDelay(@RequestBody @Valid FinishDelayInIdVO vo) {
        System.out.println(vo);
        return delayService.finishDelay(vo);
    }

    @PostMapping("/search")
    public List<SearchDelaysResultVO> listDelaysAboutPhoneAndSeriveid(@RequestBody @Valid SearchDelayInPhoneVO vo) {
        return delayService.listDelaysAboutPhoneAndSeriveid(vo);
    }

}
